<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Section 1.2.&nbsp; The Components of a PHP Application</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1-SECT-1.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1-SECT-3.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<br><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"><a name="learnphpmysql-CHP-1-SECT-2"></a>
<h3 id="title-IDABDF1H" class="docSection1Title">1.2. The Components of a PHP Application</h3>
<p class="docText">In order to process and develop dynamic web pages, you'll need to use and understand several technologies. There are three main components to creating dynamic web pages: a web server, a server-side programming language, and a database. It's a good idea to have an understanding of the three basic components for web development using PHP. Start with some rudimentary understanding of the history and purpose of Apache (your web server), PHP (your server-side programming language), and MySQL (your database). This can help you understand how they fit into the web development picture.</p>
<p class="docText">Remember that dynamic web pages pull information from several sources simultaneously, including Apache, PHP, MySQL, and Cascading Style Sheets (CSS), which we'll talk about later.</p>
<a name="learnphpmysql-CHP-1-SECT-2.1"></a>
<h4 id="title-IDALDF1H" class="docSection2Title">1.2.1. Birth of PHP</h4>
<p class="docText">PHP grew out of a need for people to develop and maintain web sites containing dynamic client-server functionality. In 1994, Rasmus Lerdorf created a collection of open source Perl scripts for his personal use, and these eventually were rewritten in C and turned into what PHP is today. By 1998, PHP was released in its third version, turning it into a web development tool that could compete with similar products such as Microsoft's Active Server Pages (ASP) or Sun's Java Server Pages (JSP).</p>
<p class="docText">The real beauty of PHP is its simplicity coupled with its power, as well as it being an interpreted language, rather than a compiled one.</p>
<p><table border="0" bgcolor="black" cellspacing="0" cellpadding="1" width="90%" align="center"><tr><td><table bgcolor="white" width="100%" border="0" cellspacing="0" cellpadding="6"><tr><TD width="60" valign="top"><img src="images/tip_yellow.jpg" width="50" height="54" alt=""></td><td valign="top">
<p class="docText">Compiled languages create a binary <span class="docEmphasis">.exe</span> file, while interpreted languages work directly with the source code when executing as opposed to creating a standalone file.</P>
</TD></tr></table></TD></tr></table></p><br>
<p class="docText">PHP is ubiquitous and compatible with all major operating systems. It is also easy to learn, making it an ideal tool for web-programming beginners. Additionally, you get to take advantage of a community's effort to make web development easier for everyone. The creators of PHP developed an infrastructure that allows experienced C programmers to extend PHP's abilities. As a result, PHP now integrates with advanced technologies like XML, XSL, and Microsoft's COM. At this juncture, PHP 5.0 is being used.</P>

<a name="learnphpmysql-CHP-1-SECT-2.2"></a>
<h4 id="title-IDACEF1H" class="docSection2Title">1.2.2. Birth of Apache</h4>
<a name="IDX-CHP-1-0021"></a> 

<p class="docText">Apache is a web server that turns browser requests into resulting web pages and knows how to process PHP code. PHP is only a programming language, so without the power of a web server like Apache behind it, there would be no way for web users to reach your pages that contain the PHP language code.</P>
<p class="docText">Apache is not the only web server available. Another popular web server is Microsoft's Internet Information Services (IIS), which is supplied with Windows 2000 and all later versions. For the most part, the differences between Apache and IIS come down to personal preference, although Apache has the decided advantages of being free, providing full source code, and using an unrestricted license. Apache 2.0 is the current version you'll be using. IIS is easier to integrate with Active Directory, Microsoft's latest authentication system, but this applies mostly to internal company web sites.</p>
<p><table border="0" bgcolor="black" cellspacing="0" cellpadding="1" width="90%" align="center"><TR><td><table bgcolor="white" width="100%" border="0" cellspacing="0" cellpadding="6"><tr><td width="60" valign="top"><img src="images/tip_yellow.jpg" width="50" height="54" alt=""></td><TD valign="top">
<p class="docText">According to the Netcraft web server survey, Apache has been the most popular web server on the Internet since April 1996.</P>
</td></tr></table></td></tr></table></P><br>
<p class="docText">Because web servers like Apache and IIS are made to serve up pages from HTML files, they need a way to know how to process PHP language code. Apache uses a system called modules to load extensions into its functionality. IIS uses a similar concept called ISAPI. These both allow for faster processing of the PHP code than the old school process of calling PHP as a separate executable each time the web server had a request for a page containing PHP. We'll discuss how the Apache module is set up in <a class="docLink" href="learnphpmysql-CHP-2.html#learnphpmysql-CHP-2">Chapter 2</a>.</P>

<a name="learnphpmysql-CHP-1-SECT-2.3"></a>
<h4 id="title-IDACFF1H" class="docSection2Title">1.2.3. Apache Versions</H4>
<a name="IDX-CHP-1-0022"></a> 
<a name="IDX-CHP-1-0023"></a> 
<a name="IDX-CHP-1-0024"></a> 

<p class="docText">Apache has only two major versions<a name="IDX-CHP-1-0025"></a> 
 in use today. They are 1.3 and 2. Apache 2 is a major rewrite and supports <span class="docEmphasis">threading</span>.<a name="IDX-CHP-1-0026"></a> 
 Threads are a way for a single process to manage more than one thing at a time. The benefit is an increase in speed and a reduction in the resources needed. Unfortunately, PHP isn't totally compatible with threading yet. Apache 2 has been out long enough to be considered stable for development and production use. Apache 2 also supports more powerful modules. Some additional modules can be found at <a class="docLink" target="_blank" href="http://www.cri.ensmp.fr/~coelho/mod_macro/">http://www.cri.ensmp.fr/~coelho/mod_macro/</a>. However, shared module DLLs that don't come with the official Apache source files, such as <span class="docEmphasis">mod_php4, mod_ssl, mod_auth_mysql</span>, and <span class="docEmphasis">mod_auth_ntsec</span>, can be found on the Web.</P>

<a name="learnphpmysql-CHP-1-SECT-2.4"></a>
<H4 id="title-IDANGF1H" class="docSection2Title">1.2.4. Birth of MySQL</h4>
<p class="docText">MySQL was developed in the 1990s to fill the ever-growing need for computers to manage information intelligently. The original core MySQL developers were trying to solve their needs for a database by using mSQL, a small and simple database. It become clear that mSQL couldn't solve all the problems they wanted it to, so they created a more robust database that turned into MySQL</p>
<p class="docText">MySQL supports several different <span class="docEmphasis">database engines</span>.<a name="IDX-CHP-1-0027"></a> 
 The database engine determines how MySQL handles the actual storage and querying of the data. Because of that, each storage engine has its own set of abilities and strengths. Over time, the database engines available are becoming more advanced and faster. <a class="docLink" href="#learnphpmysql-CHP-1-TABLE-1">Table 1-1</a> lists when various features<a name="IDX-CHP-1-0028"></a> 
 have been added to MySQL.</p>
<a name="learnphpmysql-CHP-1-TABLE-1"></a><p><table cellspacing="0" FRAME="hsides" RULES="all" cellpadding="4" width="100%"><caption><h5 class="docTableTitle">Table 1-1. Major MySQL releases</h5></caption><colgroup span="2"><col><col></colgroup><thead><tr><th class="thead" scope="col" align="left"><p class="docText">Version</p></th><th class="thead" scope="col" align="left"><p class="docText">Features</p></th></tr></thead><tr><td class="docTableCell" align="left"><p class="docText">3.23</p></td><TD class="docTableCell" align="left"><p class="docText">The MyISAM database engine is added and is the default engine. It handles large amounts of data efficiently.</p><p class="docText">The InnoDB database engine debuts for transaction safe database processing and support for <span class="docEmphasis">foreign keys</span>. Foreign keys allow the relationships between tables to be explicitly designated in the database.</p></TD></TR><tr><TD class="docTableCell" align="left"><p class="docText">4.0</p></td><td class="docTableCell" align="left"><p class="docText">Queries support <span class="docEmphasis">unions</span>. Unions allow merging the results of two queries into one result. Configuration changes can be made without restarting the database.</P></td></tr><TR><td class="docTableCell" align="left"><p class="docText">4.01</p></TD><td class="docTableCell" align="left"><p class="docText">A <tt>help</tt> command is included for the database client. There is support for <span class="docEmphasis">unnamed views</span>, also known as <span class="docEmphasis">subqueries</span>. Unnamed views allow you to treat a query like a separate table within a query.</p></td></tr><TR><TD class="docTableCell" align="left"><p class="docText">5.0</p></td><td class="docTableCell" align="left"><p class="docText">Database <span class="docEmphasis">triggers, stored procedures</span>, and <span class="docEmphasis">cursors</span> are added. A trigger allows code to run in the database when a triggering event occurs, such as inserting data into a table. Stored procedures allow programs to be defined and executed within the database. Cursors allow code in the database to be run for each row that matches a query.</p></TD></tr><TR><td class="docTableCell" align="left"><p class="docText">5.1</P></TD><TD class="docTableCell" align="left"><p class="docText"><span class="docEmphasis">Constraints</span> and <span class="docEmphasis">partitioning</span> are added. Constraints are used to define rules for when rows can be added or modified in the database. Partitioning is used to split up the physical storage of large tables based on a defined rule. It is commonly used to increase the performance of large tables such as historical data.</p></td></tr></table></p><br>
<p class="docText">The current production release of MySQL<a name="IDX-CHP-1-0029"></a> 
 is the latest available 5.0<span class="docEmphasis">x</span> version. MySQL 5.0 provides performance that is comparable to any of the much more expensive enterprise databases<a name="IDX-CHP-1-0030"></a> 
 such as Oracle, Informix, DB2 (IBM), and SQL Server (Microsoft). The developers have achieved this level of performance by leveraging the talents of many open source developers, along with community testing. For general web-driven database tasks, the default <tt>MyISAM</tt> database engine works perfectly fine.</p>
<p><table border="0" bgcolor="black" cellspacing="0" cellpadding="1" width="90%" align="center"><tr><td><table bgcolor="white" width="100%" border="0" cellspacing="0" cellpadding="6"><tr><td width="60" valign="top"><img src="images/tip_yellow.jpg" width="50" height="54" alt=""></td><td valign="top">
<p class="docText">The newest advanced features of MySQL 5.1 are not as stable as features introduced in prior releases. MySQL 5.0 is the current stable general release. Download the latest minor release (the largest of the third portion of the version number) for whichever major version you choose. It has the most bug fixes for that version included.</p>
</TD></tr></table></td></TR></table></P><br>
<p class="docText">Apache also has the advantage of being able to run on operating systems other than Windows, which now brings us to the subject of compatibility.</P>

<a name="learnphpmysql-CHP-1-SECT-2.5"></a>
<h4 id="title-IDA1LF1H" class="docSection2Title">1.2.5. Compatibility</h4>
<a name="IDX-CHP-1-0031"></a> 

<p class="docText">Web browsers like Firefox, Netscape, and Internet Explorer are made to process HTML, so it doesn't matter what operating system a web server runs on. Apache, PHP, and MySQL support a wide range of operating systems, so you aren't restricted to a specific OS on either the server or the client. While you don't have to worry much about software compatibility, the sheer variety of file formats and different languages that all come together does take some getting used to.</p>


<a href="11011536.html"><img src="images/pixel.jpg" alt="" width="1" height="1" border="0"></a></TD></TR></table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1-SECT-1.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1-SECT-3.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<script type="text/javascript"><!--
google_ad_client = "pub-0203281046321155";
google_alternate_ad_url = "http://www.bookhtml.com/adbrite.htm";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="4867465545";
google_color_border = "FFFFFF";
google_color_link = "0000FF";
google_color_bg = "FFFFFF";
google_color_text = "000000";
google_color_url = "0000FF";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</html>
